import { createRouter, createWebHistory } from 'vue-router'
import Home from '../views/Home.vue'
import Login from '../views/Login.vue'
import Register from '../views/Register.vue'
import Index from '../components/qiantai/Index.vue'
import LastNav from '../components/houtai/LastNav.vue'
import BookPage from '../components/qiantai/BookPage.vue'
import Order from '../components/qiantai/Order.vue'
import PersonalPage from '../components/qiantai/PersonalPage.vue'
import Alipay from '../components/qiantai/Alipay.vue'
import ChangePassword from '../views/ChangePassword.vue'
import AlipayVip from '../components/qiantai/AlipayVip.vue'
import BookComment from '../components/qiantai/BookComment.vue'
import UserManagement from '../components/houtai/UserManagement.vue'
import LastFooter from '../components/houtai/LastFooter.vue'
import KeFu from '../components/qiantai/KeFu.vue'
import BooksManagement from '../components/houtai/BooksManagement.vue'
import OrderManagement from '../components/houtai/OrderManagement.vue'
import cheshi from '../components/houtai/cheshi.vue'
import LastPersonalPage from '../components/houtai/LastPersonalPage.vue'
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: Home,
      redirect: '/index',
      children:[
  
     {
      path: '/index',
      name: 'index',
      component: Index,
      meta: {
            requireAuth: true
          }
        },
        {
          path: '/usermanagement',
          name: 'UserManagement',
          component: UserManagement,
          meta: {
                requireAuth: true
              }
        },
        {
          path: '/booksmanagement',
          name: 'BooksManagement',
          component: BooksManagement,
          meta: {
                requireAuth: true
              }
        }, 
        {
          path: '/lastpersonalpage',
          name: 'LastPersonalPage',
          component: LastPersonalPage,
          meta: {
                requireAuth: true
              }
        },
        {
          path: '/ordermanagement',
          name: 'OrderManagement',
          component: OrderManagement,
          meta: {
                requireAuth: true
              }
        },
        {
      path: '/bookpage',
      name: 'bookpage',
          component: BookPage,
          // meta: {
          //   requireAuth: true
          // }
        },
        {
          path: '/order',
          name: 'order',
          component: Order,
          meta: {
            requireAuth: true
          }
        },
        {
          path: '/kefu',
          name: 'KeFu',
          component: KeFu,
          meta: {
            requireAuth: true
          }
        },
        {
          path: '/bookcomment',
          name: 'BookComment',
          component: BookComment,
          meta: {
            requireAuth: true
          }
        },
        {
          path:'/personalpage',
          name:'personalpage',
          component: PersonalPage,
          meta: {
            requireAuth: true
          }
        },
        {
          path: '/alipay',
          name: "Alipay",
          component: Alipay,
          meta: {
            requireAuth: true
          }
        },
        {
          path: '/alipayvip',
          name: "AlipayVip",
          component: AlipayVip,
          meta: {
            requireAuth: true
          }
        },{
      path: '/lastfooter',
      name: 'lastfooter',
      component:LastFooter,
      meta: {
        requireAuth: true
      },
    }

   ]
    },
    {
      path: '/login',
      name: 'login',
      component: Login
    },
    {
      path: '/register',
      name: 'register',
      component:Register
      

    },
    {
      path: '/changepassword',
      name: 'changepassword',
      component: ChangePassword,
      meta: {
        requireAuth: true
      },
      

    },
    {
      path: '/cheshi',
      name: 'cheshi',
      component: cheshi,
      meta: {
        requireAuth: false
      },
      

    },

  
    
  ]
})

export default router
